<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    ul{
        list-style: none;
    }
    li{
        float: left;
    }
</style>
<body>
    <ul>
        <li>☆</li>
        <li>☆</li>
        <li>☆</li>
        <li>☆</li>
        <li>☆</li>
    </ul>
</body>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
    const $lis = $("li");
    $lis.mouseenter(function () {
        const idx = $(this).index();
        for (var i = idx; i >= 0; i--) {
            $lis.eq(i).text("★");
        }
    })
    $lis.mouseleave(function () {
        $lis.text("☆");
    })
</script>
</html>